/***********************************************
 This file is part of redia-bapps-main-ios.
 
 Copyright (c) 2015 Redia A/S
 
 Redia-bapps-main-ios is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 redia-bapps-main-ios is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with redia-bapps-main-ios.  If not, see <http://www.gnu.org/licenses/>.
 
 *********************************************** */

//
//  BACoverUrlMemoryCache.h
//  redia-bapps-ios
//
//  Created by Henrik Lynbech on 15/10/13.
//  Copyright (c) 2013 redia. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "BACoverUrl.h"
#import "BAAvailability.h"
#import "BAStandardResultObject.h"
#import "LazyLoadConnection.h"

@interface BACoverUrlAndAvailabilityMemoryCache : NSObject

SINGLETON_DECL_GCD(BACoverUrlAndAvailabilityMemoryCache)



/**
 Takes an NSDictionary of NSString identifiers to
 BAStandardResults with a possible BAAvailability object
 and inserts the BAAvailability objects in the cache, if any.
 */
-(void)appendAvailabilityRecords:(NSDictionary *)availabilities;
-(BAAvailability*)getAvailabilityForIdentifier:(NSString*)identifier;

-(void)fetchCoverUrlsForIdentifiers:(NSArray*)identifiers;

/**
 Takes an NSDictionary of NSString identifiers to
 BAStandardResults with a possible BACoverUrl object
 and inserts the BACoverUrl objects in the cache, if any.
 */
-(void)appendCoverUrls:(NSDictionary *)coverUrls;
-(BACoverUrl*)getCoverUrlForIdentifier:(NSString*)identifier;

/**
 This is a plain in-memory image cache, based on lookup of identifiers,
 intended for use for search result cell sized images (thumbnails).
 */
-(void)addSearchResultCellSizedCoverImage:(UIImage*)image forIdentifier:(NSString*)identifier;
-(UIImage*)getSearchResultCellSizedCoverImageForIdentifier:(NSString*)identifier;

-(void)fetchCoverImagesForIdentifiers:(NSArray*)identifiers;

/** DEP: using new notification system
 Utility function for loading cover thumbnail images directly from identifier
 *
-(void)lazyloadImageFromIdentifier:(NSString*)identifier owner:(id)owner onSuccess:(LLSuccessBlock)successBlock onError:(LLErrorBlock)errorBlock;
*/

@end
